// Copyright (C) joyinter
// All rights reserved.
// 
// Author : Lu Rong
// Date   : 2005-01-20

#ifndef __TRENCHPAGECTRL_H_CLIENT_MAIN__
#define __TRENCHPAGECTRL_H_CLIENT_MAIN__

#pragma once

#include <common\ui\pagectrl.h>
#include "roompage.h"

class CJoyTrenchPageCtrl;
class CJoyTrench;
class CJoyTrenchTabPanel_Btn;
class CJoyTrenchTabPanel_Tab;

//##ModelId=44C4B5DA005D
class CJoyTrenchCheckBox : public CJoyCheckBox
{
protected:
	friend class CJoyTrenchPageCtrl;
	friend class CJoyTrench;
	friend class CJoyTrenchPageTabSet;

	//##ModelId=44C4B5DA0060
	CJoyTrenchPageCtrl	*m_pageCtrl;

	//##ModelId=44C4B5DA0119
	enum CHECK_STATE
    {
		//##ModelId=44C4B5DA0128
        CHK_NORMAL,
		//##ModelId=44C4B5DA0129
        CHK_HOVER,
		//##ModelId=44C4B5DA012A
		CHK_CHECK
    };
	//##ModelId=44C4B5DA0070
	CHECK_STATE		m_state;

	//##ModelId=44C4B5DA0075
	Color			m_backColor1;
	//##ModelId=44C4B5DA007E
	Color			m_chkBackColor;
	//##ModelId=44C4B5DA0083
	Color			m_chkBackColor1;
	//##ModelId=44C4B5DA008D
	Color			m_hvrBackColor;
	//##ModelId=44C4B5DA0092
	Color			m_hvrBackColor1;
	//##ModelId=44C4B5DA009D
	Color			m_countColor;
	//##ModelId=44C4B5DA00A2
	Color			m_chkCountColor;
	//##ModelId=44C4B5DA00AC
	Color			m_chkTextColor;

	//##ModelId=44C4B5DA00B0
	virtual void CM_LoadSkin(CJoyXmlElement* pSkinElem);
	//##ModelId=44C4B5DA00BB
	virtual void CM_Mouse(MouseMessage msg, const CPoint& pt);
	//##ModelId=44C4B5DA00CC
    virtual void CM_MouseHover();
	//##ModelId=44C4B5DA00DB
	virtual void CM_MouseLeave();
	//##ModelId=44C4B5DA00EA
    virtual void CM_Draw(Graphics& graph);

public:
	//##ModelId=44C4B5DA00FA
	CJoyTrenchCheckBox();
	//##ModelId=44C4B5DA0109
	virtual ~CJoyTrenchCheckBox();

	//##ModelId=44C4B5DA010B
	void SetCheck(bool checked);
};

//##ModelId=44C4B5DA0148
class CJoyTrenchPageContainer : 
	public CJoyPageContainer
{
	DECLARE_DYNAMIC(CJoyTrenchPageContainer)

protected:
	friend class CJoyTrenchPageCtrl;

	//##ModelId=44C4B5DA014A
	int m_cornerSize;
	//##ModelId=44C4B5DA0158
	Color   m_frameColor;

	//##ModelId=44C4B5DA015C
    virtual void CM_LoadSkin(CJoyXmlElement* pSkinElem);
	//##ModelId=44C4B5DA0167
    virtual void CM_Draw(Graphics& graph);

public:
	//##ModelId=44C4B5DA016A
	CJoyTrenchPageContainer();
	//##ModelId=44C4B5DA0177
	virtual ~CJoyTrenchPageContainer(void);

public:
	DECLARE_MESSAGE_MAP()
};

//##ModelId=44C4B5DA0196
class CJoyTrenchPageTabSet : 
	public CJoyPageTabSet
{
	DECLARE_DYNAMIC(CJoyTrenchPageTabSet)

protected:
	friend class CJoyTrenchPageCtrl;

	//##ModelId=44C4B5DA01A6
	Color	m_cornerColor;
	//##ModelId=44C4B5DA01AA
	int		m_cornerSize;
	//##ModelId=44C4B5DA01AC
	Color	m_frameColor;
	//##ModelId=44C4B5DA01B9
	Color	m_backColor1;

	//##ModelId=44C4B5DA01BD
	int		m_step;

	//##ModelId=44C4B5DA01C6
	CJoyButton	*m_btnLeft;
	//##ModelId=44C4B5DA01CB
	CJoyButton	*m_btnRight;

	//##ModelId=44C4B5DA01D5
	CJoyTrenchTabPanel_Btn	*m_paneOfBtn;
	//##ModelId=44C4B5DA01DA
	CJoyTrenchTabPanel_Tab  *m_paneOfTab;

	//##ModelId=44C4B5DA01DE
	void CM_LeftClick(CJoyButton*);
	//##ModelId=44C4B5DA01E5
	void CM_RightClick(CJoyButton*);

	//##ModelId=44C4B5DA01E7
	virtual void CM_LoadSkin(CJoyXmlElement* pSkinElem);

public:
	//##ModelId=44C4B5DA01F6
	CJoyTrenchPageTabSet();
	//##ModelId=44C4B5DA01F7
	virtual ~CJoyTrenchPageTabSet(void);

public:
	DECLARE_MESSAGE_MAP()
	//##ModelId=44C4B5DA0205
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
};

//##ModelId=44C4B5DA0232
class CJoyTrenchPageCtrl : 
	public CJoyPageCtrl
{
	DECLARE_DYNAMIC(CJoyTrenchPageCtrl)

public:
	friend class CJoyTrenchPageTabSet;

	//##ModelId=44C4B5DA0235
	CJoyRoomPage	*m_room;
//	typedef CMap<UINT, UINT, CJoyTrench *, CJoyTrench *> CJoyTrenchList;
//	CJoyTrenchList	m_trenchList;

	//##ModelId=44C4B5DA0243
	CJoyXmlElement *m_skinTab;
	//##ModelId=44C4B5DA0248
	CJoyXmlElement *m_skinPage;

	//##ModelId=44C4B5DA024C
	int m_leftVisible;

public:
	//##ModelId=44C4B5DA0251
	virtual CJoyPageContainer * CreateContainer();
	//##ModelId=44C4B5DA0253
	virtual CJoyPageTabSet* CreateTabSet();
	//##ModelId=44C4B5DA0255
	virtual void LoadSkin(CJoyXmlElement* pSkinElem);

	//##ModelId=44C4B5DA0263
	void BuildTabArea();
	//##ModelId=44C4B5DA0264
	void BuildTabAreaTop();

	//##ModelId=44C4B5DA0265
	int GetTabSetWidth();

	//##ModelId=44C4B5DA0271
	void AddPage(const CString& name, CJoyWnd* page);
	//##ModelId=44C4B5DA0274
	void RemoveAll();
//	CJoyWnd* RemovePage(const CString& name);
//	POSITION GetItemPos(const CString& name);

public:
	//##ModelId=44C4B5DA0275
	CJoyTrenchPageCtrl(void);
	//##ModelId=44C4B5DA0281
	virtual ~CJoyTrenchPageCtrl(void);

public:
	DECLARE_MESSAGE_MAP()
	//##ModelId=44C4B5DA0284
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
};

#endif  // __TRENCHPAGECTRL_H_CLIENT_MAIN__
